﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Turquoise.Core.Abstract;
using Turquoise.DataAccess.Helpers;

namespace Turquoise.DataAccess.Abstract
{
    public interface IRepository<T> where T : class, IEntity, new()
    {
        IQueryable<T> DbSet();
        T Add(T entity);
        T Update(T entity);
        void Delete(T entity);
        void Delete(Expression<Func<T, bool>> whereExpression);
        T Get(Expression<Func<T, bool>> whereExpression);
        T Get(Expression<Func<T, object>>[] includeExpressions, Expression<Func<T, bool>> whereExpression);
        List<T> GetList();
        List<T> GetList(Expression<Func<T, bool>> whereExpression);
        List<T> GetList(Expression<Func<T, object>>[] includeExpressions, Expression<Func<T, bool>> whereExpression);
        List<T> GetList(Expression<Func<T, bool>> whereExpression, SortHelper<T> sortHelper);
        List<T> GetList(Expression<Func<T, object>>[] includeExpressions, Expression<Func<T, bool>> whereExpression, SortHelper<T> sortHelper);
        List<T> GetList(Expression<Func<T, bool>> whereExpression, SortHelper<T> sortHelper, int index, int size);
        List<T> GetList(Expression<Func<T, object>>[] includeExpressions, Expression<Func<T, bool>> whereExpression, SortHelper<T> sortHelper, int index, int size);
        int GetCount(Expression<Func<T, bool>> whereExpression);
        int GetCount(Expression<Func<T, object>>[] includeExpressions, Expression<Func<T, bool>> whereExpression);
        void Dispose();
    }
}
